const Student = require("./student.js").Student;
const Klass = require("./klass.js").Klass;
const Teacher = require('./teacher.js').Teacher;

function teacherTestNotNullKlass() {
    let teacher = new Teacher('Tom', 21, new Klass(2));
    let expectResult = 'My name is Tom. I am 21 years old. I am a Teacher. I teach Class 2.';
    if (teacher.introduce() === expectResult) {
        console.log('test passed');
    } else {
        console.log('test failed');
    }
}

function teacherTestNullKlass() {
    let teacher = new Teacher('Tom', 21);
    let expectResult = 'My name is Tom. I am 21 years old. I am a Teacher. I teach no Class.';
    if (teacher.introduce() === expectResult) {
        console.log('test passed');
    } else {
        console.log('test failed');
    }
}

function teacherIntroduceWith(){
    let teacher = new Teacher('Tom',21,new Klass(2));
    let jerry = new Student('Jerry',21,new Klass(2));
    let expectedResult = 'My name is Tom. I am 21 years old. I am a Teacher. I teach Jerry.';
    if(teacher.introduceWith(jerry) === expectedResult){
        console.log('test passed');
    }else{
        console.log('test failed');
    }
}

function teacherIntroduceNotWith() {
    let teacher = new Teacher('Tom',21,new Klass(2));
    let jerry = new Student('Jerry',21,new Klass(3));
    let expectedResult = 'My name is Tom. I am 21 years old. I am a Teacher. I don\'t teach Jerry.';
    if(teacher.introduceWith(jerry) === expectedResult){
        console.log('test passed');
    }else{
        console.log('test failed');
    }
}

teacherTestNotNullKlass();

teacherTestNullKlass();

teacherIntroduceWith();

teacherIntroduceNotWith();